#include "s3c2440_soc.h"

void delay(volatile int ms)
{
	while(ms--);
}

int led_init(void)
{
	/* 设置 GPFCON 让 GPFCON4/5/6为 输出引脚*/
	GPFCON &= ~((3 << 8) | (3 << 10) | (3 << 12));
	GPFCON |=  ((1 << 8) | (1 << 10) | (1 << 12));


	/* 默认关闭LED */
	GPFDAT = 0x00000070;

	return 0;
}

int led1_on(void)
{

	GPFDAT &= ~(1 << 4);

	return 0;
}

int led1_off(void)
{

	GPFDAT |= (1 << 4);

	return 0;
}

int led2_on(void)
{

	GPFDAT &= ~(1 << 5);

	return 0;
}

int led2_off(void)
{

	GPFDAT |= (1 << 5);

	return 0;
}

int led3_on(void)
{

	GPFDAT &= ~(1 << 6);

	return 0;
}

int led3_off(void)
{

	GPFDAT |= (1 << 6);

	return 0;
}

int main(void)
{
	led_init();

	/* 循环点亮 */
	while (1)
	{
		led1_on();
		delay(100000);
		led1_off();
		delay(100000);

		led2_on();
		delay(100000);
		led2_off();
		delay(100000);

		led3_on();
		delay(100000);
		led3_off();
		delay(100000);
	}

	return 0;
}
